package com.xiangming.demo.controller;
import com.xiangming.demo.entity.FileData;
import com.xiangming.demo.entity.StatusCode;
import com.xiangming.demo.service.MetaService;
import com.xiangming.demo.utils.Result;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author wxm
 * @data 2021/11/13
 */
@RestController
public class MetaController {
    Logger logger = LoggerFactory.getLogger(MetaController.class);
    @Autowired
    MetaService metaService;


    /**
     * 获取元数据信息
     * @param uuid uuid
     * @return
     */

    @GetMapping("/meta")
    public Result metaFile(@RequestParam("uuid") String uuid){

        FileData file = metaService.selectAll(uuid);

      if (!file.equals("")){
          logger.info("-----info------请求执行成功");
          return new Result(true, StatusCode.OK,"查询成功",file);
      }else {
          logger.info("-----info------请求执行失败");
          return new Result(false,StatusCode.ERROR,"查询失败");
      }


    }

}
